<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>MyClouds：主页：修改密码</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
	</head>
	<body>

		<form class="layui-form" style="padding: 20px 30px 0 0;" lay-filter="user-form">
			<input type="hidden" name="id" />
			<div class="layui-form-item">
				<label class="layui-form-label">用户姓名</label>
				<div class="layui-input-block">
					<input type="text" name="name" class="layui-input" disabled="disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">登录账号</label>
				<div class="layui-input-block">
					<input type="text" name="account" class="layui-input" disabled="disabled">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">原密码</label>
				<div class="layui-input-block">
					<input type="password" name="password" lay-verify="required" placeholder="请输入当前密码" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">新密码</label>
				<div class="layui-input-block">
					<input type="password" name="new_password" lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">确认密码</label>
				<div class="layui-input-block">
					<input type="password" name="confirm_password" placeholder="请再次输入新密码" lay-verify="required" autocomplete="off"
					 class="layui-input">
				</div>
			</div>

			<div class="layui-form-item layui-hide">
				<input type="button" lay-submit lay-filter="btn-submit" id="btn-submit" value="提交">
			</div>
		</form>
	</body>

	<script src="../../layuiadmin/layui/layui.js"></script>
	<script type="text/javascript">
		layui.config({
			base: '../../layuiadmin/'
		}).extend({
			index: 'lib/index'
		}).use(['index', 'form', 'myutil'], function() {
			var $ = layui.$,
				myutil = layui.myutil,
				form = layui.form;
			// 重置
			form.on('submit(btn-submit)', function(data) {
				if (data.field.new_password != data.field.confirm_password) {
					layer.msg('新密码和确认密码不一致，请重新输入', {
						icon: 5
					});
					return;
				}
				var win = parent.layer.getFrameIndex(window.name);
				myutil.ajax({
					url: layui.setter.my.surl + 'admin/system/home/updatePwd',
					data: data.field,
					ok: function(res) {
						parent.layer.alert(res.msg, {
							icon: 1
						}, function(index) {
							parent.layer.close(index);
							parent.layer.close(win);
						});
					}
				});
			});

		});
	</script>

</html>
